/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.admanager.soadmanagement.plugin.soadmanagement.impl;

import java.util.Collection;

import org.admanager.soadmanagement.plugin.soadmanagement.PComponent;
import org.admanager.soadmanagement.plugin.soadmanagement.PComponentReference;
import org.admanager.soadmanagement.plugin.soadmanagement.PComponentService;
import org.admanager.soadmanagement.plugin.soadmanagement.soadmanagementPackage;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>PComponent</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.PComponentImpl#getReference <em>Reference</em>}</li>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.PComponentImpl#getService <em>Service</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PComponentImpl extends PElementImpl implements PComponent {
	/**
	 * The cached value of the '{@link #getReference() <em>Reference</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getReference()
	 * @generated
	 * @ordered
	 */
	protected EList reference;

	/**
	 * The cached value of the '{@link #getService() <em>Service</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getService()
	 * @generated
	 * @ordered
	 */
	protected EList service;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PComponentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return soadmanagementPackage.Literals.PCOMPONENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getReference() {
		if (reference == null) {
			reference = new EObjectContainmentEList(PComponentReference.class, this, soadmanagementPackage.PCOMPONENT__REFERENCE);
		}
		return reference;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getService() {
		if (service == null) {
			service = new EObjectContainmentEList(PComponentService.class, this, soadmanagementPackage.PCOMPONENT__SERVICE);
		}
		return service;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case soadmanagementPackage.PCOMPONENT__REFERENCE:
				return ((InternalEList)getReference()).basicRemove(otherEnd, msgs);
			case soadmanagementPackage.PCOMPONENT__SERVICE:
				return ((InternalEList)getService()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case soadmanagementPackage.PCOMPONENT__REFERENCE:
				return getReference();
			case soadmanagementPackage.PCOMPONENT__SERVICE:
				return getService();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case soadmanagementPackage.PCOMPONENT__REFERENCE:
				getReference().clear();
				getReference().addAll((Collection)newValue);
				return;
			case soadmanagementPackage.PCOMPONENT__SERVICE:
				getService().clear();
				getService().addAll((Collection)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case soadmanagementPackage.PCOMPONENT__REFERENCE:
				getReference().clear();
				return;
			case soadmanagementPackage.PCOMPONENT__SERVICE:
				getService().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case soadmanagementPackage.PCOMPONENT__REFERENCE:
				return reference != null && !reference.isEmpty();
			case soadmanagementPackage.PCOMPONENT__SERVICE:
				return service != null && !service.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //PComponentImpl
